//多实例数据库配置 database-multi.html
app.controller('databaseMultiCtrl', function ($scope, $http) {
  //页面通用初始化
  pageInit('database');
  //初始化
  $http.get('/deploy/main/init').then(function (response) {
    $scope.apps = apps;
    if (response.status == 200) {
      var message = response.data;
      if (message.code == 0) {
        var data = message.data;
        //单选框
        $scope.databaseSchema = data.databaseSchema;
        //多选框
        var deployApps = data.deployApps ? data.deployApps : [];
        for (var i = 0; i < deployApps.length; i++) {
          apps[deployApps[i]].sel = true;
        }
      } else {
        $.showNotice(message.msg, "danger");
      }
    }
  }).catch(function (response) {
    $.showNotice(response.status + " error：" + response.data.message, "danger");
  });
  $scope.apps = apps;
  $scope.changeTab = function (index) {
    $("#database-tab" + index).parent().addClass("active").siblings().removeClass("active");
    $("#database-tab" + index + "-content").addClass("active").siblings().removeClass("active");
  }
});